package org.stars.dao.sqlmapper;

import java.util.ArrayList;
import java.util.List;

import org.stars.dao.sqlmapper.macro.Macro;

/**
 * Rapresent a macro
 * 
 * @author Francesco Benincasa
 * 
 */
public class SqlMacro extends SqlFragment {
	
	private static final long serialVersionUID = -3322018069241973038L;
	
	@Override
	public SqlMacro clone()
	{
		SqlMacro newObject=new SqlMacro(null,null);
		copyValues(newObject);
		
		newObject.templateArgs=getTemplateArgs();
		newObject.templateText=getTemplateText();
		newObject.args=new ArrayList<String>();
		newObject.type=type;
		
		for (String item: getArgs())
		{
			newObject.args.add(item);
		}
		return newObject;		
	}

	public SqlMacro(String templateArgsValue, String templateSqlValue)
	{		
		templateArgs=templateArgsValue;
		templateText=templateSqlValue;
		args=new ArrayList<String>();
	}
	
	public SqlMacro(String templateArgsValue)
	{		
		templateArgs=templateArgsValue;
		templateText="";
		args=new ArrayList<String>();
	}

	protected List<String> args;	

	public List<String> getArgs() {
		return args;
	}

	public void setArgs(List<String> args) {
		this.args = args;
	}

	protected String templateArgs;
	protected Macro type;
	protected Macro parentMacro;

	public String getTemplateArgs() {
		return templateArgs;
	}

	public void setTemplateArgs(String templateArgs) {
		this.templateArgs = templateArgs;
	}

	public Macro getType() {
		return type;
	}

	public void setType(Macro type) {
		this.type = type;
	}

	public Macro getParentMacro() {
		return parentMacro;
	}

	public void setParentMacro(Macro parentMacro) {
		this.parentMacro = parentMacro;
	}
	
}
